<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .red{
            height: 100px;
            width: 500px;
            background: red;
        }
    </style>
</head>
<body>
    <div id="box">
        这是div标签
    </div>
    <script type="text/javascript">
        var box = document.getElementById("box");
        box.className = "red";
    </script>

</body>
</html>